<template>
  <div>
    <div class="header">
      <van-nav-bar title="其他"
        left-arrow
        @click-left="onClickLeft" />
    </div>
    <div class="main">
      <!-- 优惠券单元格 -->
      <van-coupon-cell
        :coupons="coupons"
        :chosen-coupon="chosenCoupon"
        @click="showList = true"
      />
      <!-- 优惠券列表 -->
      <van-popup
        v-model="showList"
        round
        position="bottom"
        style="height: 90%; padding-top: 4px;"
      >
        <van-coupon-list
          :show-close-button="false"
          :show-exchange-bar="false"
          :coupons="coupons"
        />
      </van-popup>
    </div>
  </div>
</template>

<script>
import { getcouponlist } from '../../apis/meApi';
export default {
  data(){
    return{
      chosenCoupon: -1,
      coupons: [],
      showList:false
    }
  },
  created () {
    getcouponlist().then(res => {
      this.coupons = res.data
    })
  },
  methods:{
    onClickLeft(){
      this.$router.go(-1);
    },
    quitEvt(){
      this.$store.commit('common/mutationToken','')
      this.$store.commit('common/mutationUser','')
      localStorage.removeItem('token')
      this.$router.push("/login");
    },
  }
}
</script>


<style lang="less" scoped>
  // .bigBox{
  //   height: 100%;
  //   margin: 0 15px;
  //   .box{
  //     height: calc(100% - 46px);
  //     overflow-x: hidden;
  //   }
  // }
</style>